void solve()
{
	int n;
	cin >> n;

	vector<vector<int>> g(n + 1);
	vector<int> c(n + 1);
	for (int i = 1; i < n; i++) {
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}

	int mxd = 0;
	auto dfs = [&](auto &&dfs, int u, int fa, int dep) -> void {
		c[dep]++;
		mxd = max(mxd, dep);
		for (auto &v : g[u]) {
			if (v != fa) {
				dfs(dfs, v, u, dep + 1);
			}
		}
	};
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		vector<ll> f(n + 1), ff(n + 1);
		for (auto &v : g[i]) {
			mxd = 0;
			dfs(dfs, v, i, 1);
			for (int k = 1; k <= mxd; k++) {
				ans += c[k] * ff[k];
				ff[k] += f[k] * c[k];
				f[k] += c[k];
				c[k] = 0;
			}
		}
	}
	cout << ans;
}